<template>
    <div class="layout">
        <Tponav class="nav" toggleMenuButtonVisible isfixed/>
        <div class="content">
            <aside v-if="menuVisible">
                <h2>文档</h2>
                <ol>
                    <li>
                        <router-link to="/doc/intro">介绍</router-link>
                    </li>
                    <li>
                        <router-link to="/doc/install">安装</router-link>
                    </li>
                     <li>
                        <router-link to="/doc/get-started">开始使用</router-link>
                    </li>
                </ol>
                <h2>组件列表</h2>
                <ol>
                    <li>
                        <router-link to="/doc/switch">Switch 组件</router-link>
                    </li>
                    <li>
                        <router-link to="/doc/button">Button 组件</router-link>
                    </li>
                    <li>
                        <router-link to="/doc/dialog">Dialog 组件</router-link>
                    </li>
                    <li>
                        <router-link to="/doc/tabs">Tabs 组件</router-link>
                    </li>
                    <li>
                        <router-link to="/doc/input">Input 组件</router-link>
                    </li>
                </ol>
            </aside>
            <main>
                <router-view />
            </main>
        </div>
    </div>
</template>

<script setup lang="ts">
import { inject, Ref } from 'vue';
import Tponav from '../components/Topnav.vue'

const menuVisible = inject<Ref<boolean>>('menuVisible') as Ref<boolean>
</script>

<style scoped lang="scss">
.layout {
    display: flex;
    flex-direction: column;
    height: 100vh;

    >.nav {
        flex-shrink: 0;
        z-index: 3;
        background-color: #BCEDD0;
        border-bottom: 1px solid rgba(0,0,0,.1);
    }

    >.content {
        flex-grow: 1;
        padding-top: 60px;
        padding-left: 156px;

        @media (max-width:550px) {
            padding-left: 0;
        }

        display: flex;

        >aside {
            flex-shrink: 0;
        }

        >main {
            flex-grow: 1;
            padding: 16px;
            background: white;
        }
    }

}

aside {
    background: #BCEDD0;
    color: #434343;
    width: 150px;
    padding: 16px 0;
    position: fixed;
    top: 0;
    left: 0;
    padding-top: 70px;
    height: 100%;
    z-index: 2;

    >h2 {
        margin-bottom: 4px;
        padding: 0 16px;
    }

    >ol {
        >li {
            >a {
                display: block;
                padding: 4px 16px;
                text-decoration: none;
            }

            .router-link-active {
                background: white;
                border-right: 4px solid rgba(#74B9B4, 0.9);
            }

        }
    }
}

main {
    overflow: auto;
}
</style>